package GUI.Administracion;

import java.rmi.RemoteException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import service.article.exceptions.ProxyException;
import GUI.Cliente.MainCliente;
import GUI.Productos.MenuProductos;

public class MenuAdmin extends Shell {

	/**
	 * Launch the application.
	 * @param args
	 */
	static MenuAdmin shell;
	static Display display;

	
	
	
	
	public static void main(String args[]) {
		try {
			display = Display.getDefault();
			 shell = new MenuAdmin(display);
			shell.open();
			shell.layout();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the shell.
	 * @param display
	 */
	public MenuAdmin(final Display display) {
		super(display, SWT.SHELL_TRIM);
		
		Button btnGestionDeArticulos = new Button(this, SWT.NONE);
		btnGestionDeArticulos.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				MenuProductos m = new MenuProductos(shell, shell.getStyle());
				m.open();
				
			}
		});
		btnGestionDeArticulos.setBounds(98, 52, 237, 28);
		btnGestionDeArticulos.setText("Gestion de Articulos");
		
		Button btnGestionDeClientes = new Button(this, SWT.NONE);
		btnGestionDeClientes.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				MainCliente menu = new MainCliente (shell, shell.getStyle());
				menu.open();
				
			}
		});
		btnGestionDeClientes.setBounds(98, 101, 237, 28);
		btnGestionDeClientes.setText("Gestion de Clientes");
		
		Button btnNewButton = new Button(this, SWT.NONE);
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				AgregarEmpleado a = new AgregarEmpleado (shell, shell.getStyle());
				a.open();
			}
		});
		btnNewButton.setBounds(102, 149, 233, 28);
		btnNewButton.setText("Agregar Nuevo Usuario/Empleado");
		createContents();
	}

	/**
	 * Create contents of the shell.
	 */
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 300);

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

}
